export function conversionTreeLabel(treeData = []) {
  treeData.forEach((item) => {
    if (Object.keys(item).includes('children')) {
      item.typeName_noNum = item.typeName
      item.typeName = `${item.typeName}(${item.rNum})`

      // 递归遍历子节点
      conversionTreeLabel(item.children)
    } else {
      item.typeName_noNum = item.typeName
      item.typeName = `${item.typeName}(${item.rNum})`
    }
  })

  return treeData
}

export function conversionMindMapData(mindMapData = []) {
  mindMapData.forEach((item) => {
    item.collapsed = false
    if (!item.id) {
      item.id = item.typeCode
    } else {
      item.id = `${item.id}`
      item.idOperate = item.id
    }
    if (Object.keys(item).includes('children')) {
      item.label = `${item.typeName} (${item.rNum})`
      conversionMindMapData(item.children)
    } else {
      item.label = `${item.typeName}`
    }
  })
}
